package com.cinema.service.impl;

import com.cinema.dao.FilmDao;
import com.cinema.entity.Film;
import com.cinema.service.FilmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FilmServiceImpl implements FilmService {

    @Autowired
    private FilmDao filmDao;

    @Override
    public Film queryFilmByName(String filmName){

        //通过filmName查找电影相关信息
        return filmDao.queryByName(filmName);
    }

    @Override
    //通过电影名查找电影名
    public int queryFilmIdByName(String fileName) {
        Integer filmId =  filmDao.queryFilmIdByName(fileName);
        if (filmId != null){
            return filmId.intValue();
        }
        return -1;
    }
}
